<?php defined('SYSPATH') or die('No direct script access.'); ?>

<?php echo Form::open('admin/merchmanagement/items/create/'.$category->id,
		array('method' => 'POST', 'enctype' => 'multipart/form-data'))?>
<?php echo Form::hidden('category_id', $category->id);?>


<?php echo Form::label('name', 'Name');?>
<?php echo Form::input('name', Arr::get($values, 'name'));?>
<?php if(Arr::get($errors, 'name')):?>
<?php echo Form::label('name', Arr::get($errors, 'name'), array('class' => 'error'));?>
<?php endif;?>


<?php echo Form::label('price', 'Price');?>
<?php echo Form::input('price', Arr::get($values, 'price'));?>
<?php if(Arr::get($errors, 'price')):?>
<?php echo Form::label('price', Arr::get($errors, 'price'), array('class' => 'error'));?>
<?php endif;?>

<?php echo Form::label('restock_price', 'Restock Price');?>
<?php echo Form::input('restock_price', Arr::get($values, 'restock_price'));?>
<?php if(Arr::get($errors, 'restock_price')):?>
<?php echo Form::label('restock_price', Arr::get($errors, 'restock_price'), array('class' => 'error'));?>
<?php endif;?>

<?php echo Form::label('description', 'Description');?>
<?php echo Form::textarea('description', Arr::get($values, 'description'));?>
<?php if(Arr::get($errors, 'description')):?>
<?php echo Form::label('description', Arr::get($errors, 'description'), array('class' => 'error'));?>
<?php endif;?>


<h3>Image</h3>
<?php echo Form::label('image', 'Choose File');?>
<?php echo Form::file('image');?>
<?php if(Arr::path($errors, '_external.image')):?>
<?php echo Form::label('image', Arr::path($errors, '_external.image'), array('class' => 'error'));?>
<?php endif;?>


<h3>Attributes</h3>
<?php $attr_count = 0;?>
<?php foreach($attributes as $attr):?>
<h4>
<?php echo Form::checkbox('attr'.$attr->id, $attr->id, FALSE,
		array('id' => 'attr'.$attr->id, 'class' => 'attribute'));?>
<?php echo $attr->name; ?></h4>
<ul>
<?php $value_count = 0;?>
<?php foreach($attr->values->order_by('value', 'asc')->find_all() as $val):?>
<li>
<?php echo Form::checkbox('value'.$val->id, $val->id, FALSE,
		array('class' => 'valueofattr'.$attr->id));?>
<?php echo $val->value;?>
</li>
<?php endforeach;?>
</ul>
<?php endforeach;?>
<br>
<?php echo Form::submit('submit', 'Submit')?>
<?php echo Form::close();?>
<br>
<br>
<?php echo Html::anchor('admin/merchmanagement/items/index/'.$category->id, 'Back to '.$category->name); ?>
